widget: Don't snapshot foreign children
authorMatthias Clasen <mclasen@redhat.com>
Mon, 18 Mar 2019 11:51:47 +0000 (07:51 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Tue, 28 May 2019 20:25:13 +0000 (20:25 +0000)
When snapshotting, we walk down the widget tree.
We need to skip children that have a different
surface, since those will do their own snapshot.

gtk/gtkwidget.c

index b771d25b51c3980c7697ad8d956faed36524f53e..0f21d1d3600c7e1eb217d1ee17198a224af838df 100644 (file)
@@ -13367,6 +13367,8 @@ gtk_widget_forall (GtkWidget   *widget,
  *
  * gtk_widget_snapshot_child() takes care of translating the origin of
  * @snapshot, and deciding whether the child needs to be snapshot.
+ *
+ * This function does nothing for children that implement #GtkNative.
  **/
 void
 gtk_widget_snapshot_child (GtkWidget   *widget,
@@ -13378,6 +13380,9 @@ gtk_widget_snapshot_child (GtkWidget   *widget,
   g_return_if_fail (_gtk_widget_get_parent (child) == widget);
   g_return_if_fail (snapshot != NULL);
 
+  if (GTK_IS_NATIVE (child))
+    return;
+
   gtk_snapshot_save (snapshot);
   gtk_snapshot_transform (snapshot, priv->transform);